added flat page support