avoid children query when not needed

avoid children query when not needed. this is a big performance improvement for sites with hundres of pages.