Change error handling for setup script
Fix control variable