add rangeCount before getRangeAt for FireFox exception