If the default global ENCODER/DECODER are undef the reset them
Add thread support