Fix test and code for Python3 and fix validation for utf8 registration messages