program exit correctly in debug mode now