fixed exit() bug