fixing timeEndReached bug (execution doesn't stop)