fix bug: wrong number of arguments for write