Undefined local variable throws exception. Closes #2