Decoder: throw exception instead of returning 0 if not solvable

and other assorted coding fixes