fixed oldvalue assignment