fix variable shadowing bug