fixed error in write_integer