Fix to email script