introduced std errno.h, better error handling on return val