Pages logic fixed