script stops executing bug