functions to save/load basic types and shallow vectors