fixing mail class cast exeption (or hope it's fixed)