Fixed a few bug