Javascript fix attempt