bug fix and made decode string public as well