fixed errno problem