Better error handling

#24 #25