Fix connection problems in IE because trimRight() isn't supported