constantified error message
added encodeReferenceToken