another fix for $portalPath in javascript