improve cow memory managment