Modified script and fixed issue with illegal things