bug because of reuse of var name.