various bug fix