Fixing #1263 and little bit refactoring

The fix itself is only the new exit(0)