pageloadfunction only executes on index page