Javascript moth fix