Fixes issue with categories after json encoding

Json does not allow integer keys in dictionaries.  Must override _fromdict and reset the keys in categories to the appropriate type.