fix on mail function in controllers