too many open files bug fixed
fixed error messages and better error handling