Fix range selection in IE8

I was using the editor in IE8 and came across some errors with range selection.  The fixes I made seem to work.  Please confirm.  Thanks.