fixes  #818

handle errors