write preferences implemented