undefined variable error fixed for single page with no children