fix for selectedRange undefinded exceptions