So IMO the right fix is before the two `setOrientation` in if and else do this check.