decode_key_signature() got scrambled somehow. Unscrambling.
Added some (commented out) code to deal with out of range values.