fix a crash when taking a photo