fixed double file descriptor open