Fix bugs introduced by refactoring.
Renamed decode_ex -> decode