mail settings, fixed a bunch of issues with ORM model