Duplicate photos crash fix