Fix bug were encoding types where type is not registered.