fixed packet encoding to keep backward compatibility with 0.9