code refactoring in funcs.php change object type casting in email class.