Fix JavaScript error