Fix some bugs and improved