fixed gallery bug