picture gallery pagination fix