fix bug in belongs to many pagination.
Merge branch '4.0'