Fix stdout and stdin stubbing