Fix bug in decoder