bug fix on frame flip