Fix exiting prematurely