Fix broken JavaScript