typo fixes
Fixed _errno()
Refactoring code for some level of POSIX compatibility