check for undefined in getElementsByClassName to work with IE8