Fixed some bugs and improved output of language detector.