Bug with edit mode in gallery