Fix some bugs and Update samples