added exit code if error