Fixed some part of JavaScript code to pass the JSHints checks