fixed up error handling
docs