Copter 3.4.6 loiter mode with px4flow and lidar

When I use ArduCopter 3.4.6 to test loiter, I found a serial problem
1、when you fly in althold first ,you can’t swich to loiter mode.
2 、when loiter mode fly ,the copter can loiter well.
3、 when the flow quality is bad like 0,the copter will change the attitude and report EKF IMU0 ha stopped aidding.EKF IMU0 is using optflow,EKF IMU1 ha stopped aidding.EKF IMU1 is using optflow,but when the quality is good, it will work well.
4 、my parameter is
EKF2 = ENABLE
EKF_GPS_TYPE =3
EKF_ALT_SOURCE= 1
FLOW_ENABLE =1,
RNGSERIAL4_PROTOCOL = 9 (Lidar)
SERIAL4_BAUD = 9 (9600 baud) here I add a new reliable sonar to replace the lidar
RNGFND_TYPE = 8 (LightWareSerial)
RNGFND_SCALING = 1
RNGFND_MIN_CM = 10
RNGFND_MAX_CM = 300
5、when loiter you’ll found loiter mode you can’t control your copter higher,but can lower.
and I change the RNGFND_MAX_CM = 700, the Copter can change alttitude higher.but it like a altitude fence in higher alttitude .
#LOG(here is my log)
https://drive.google.com/open?id=0BzGGSi-fifveZTN5aDNHSFIwMkk