fix gallery bug