Fix error flow