Fix typo in js substring call