fix encodeWithCode to be compatible with new gray-code >= 0.3