file descriptor check related fixes