mail: the first step. & fixed some bugs.