Fixed crash when adding reference image
