Improved error handling for the trainer
Some minor improvements