fix throwing of exceptions