fix gallery behaviour when cancel is clicked