several bug fix