Fix unbound local variable error in tuner.py.