Improve demo, fix debug bugs