fixed a variable aliasing problem