fix corruption of values variable