Exception on UboundLocalError #37 fix

Exception on UboundLocalError #37 fix