Fix template in javascript