write and read a variable from an object