Make script more stable