Make the script more reliable