fixing app crashing on previewpicture in edit mode