Added assertions
Removed cause of warnings on.exit