Fix printing bug

I forgot to add one expression to an if-statement, causing an infinite number of pages to be printed.