Change JS code to correct mistake