Add a complete demo, fix bug and add sample.