Use correct exit return values.
Add some missing exit calls.