fixed first, last pagination problem