Fixed #17 and other problems with ascii encoding