Fix HTTP_REFERER and $currenturl issues