fix encoding bug in serialized ID