Fix flip viewport bug