add test for preserving value of variables