BUG: ValueError for 'bars' masked by UnboundLocalError

for 'freq'