Fixed bug in decoder