error handling

Error handling standardized