fixing file opening problem with codecs
connecting results to the UI