Fixed encdoing bug.