added exit on error