Fix premature script exit