session: switched read/write functions to work with []byte instead of string and get rid of unused copies