Quick and dirty fix for: UnboundLocalError: local variable 'conn' referenced before assignment