Fix frontend JS errors