fix runtime error, and support switch the camera