[Updated gallery js to parse limit as int]