added write16 function (not working by now)