another way to fix the bug with app crash when trying to take a photo