Fixed an error if pagination is enabled