improved boxed values reading/writing. new unified functions for both boxed and unboxed values