Improve writing to cvars