readability in getPages(), fixed a bug