update write_scalar api