Fixed UnboundLocalError in handlers.py. Fixes #12