Fixes to error handling, messages