fix the way exceptions are thrown