better error handling that works #284 #285