Fix crash when taking picture.