fixed error handling and data errors