revised the poor fix of cont. exiting to a better one