Fixed variable-assignment bug