Fix JavaScript code