Fix for error in pagination calcula