refactoring

* copied a variable instead of referencing it