Tidy up error reporting