Correct message packgin code in writeBytes