Fixed gallery selection issue