clean up some exception handling