fixed pagination and duplication bugs