Fix some bug about gallery