js fix for pagination