Fix JavaScript loading bug