Fix broken PURL generation in JS