fix bug for pagination