fatal mistake where too many images were being saved because current session was not being checked