Fixed bug where IE could throw an error when search/replacing contents due to an invalid selection being returned.