Merge "Fix condition for waiting next frame" into main