made pacman extension more robust, make exiting happen on time