fixed some type checking on OS errors