fixed conditions for the last frame