fixed  bugs to pagination