add some demo code and fix some bugs