fixed bug in decoder