fixed buggy email script