fixed bug in mailcontroller