serveral bug fix