add demo and fix bugs