fix UnboundLocalError in machine actions