changed error handling. resolved #10