Fix duplication of javascript being called twice