bug fix and improve