Fixed a bugs