fixed errno usage