minor tweak to error handling