bugfix of error handling while open()