Fix flows and error catching