debugged the script