fixed exit routine