using serialize and deserialize to read/store magic numbers.