Fixed bug where instance variables were local instead