Fixing issues with the resend script