A few bug fix