fixed counting of role entry points
added missing check if PAGE_ID is defined