error handling and fixes