redirection fixes after email invoice and code cleanup