made the script safer