a few bug fix