improved error handling
improved error and warning handling