Fix critical bug which drops some characters

See bug #25 on github