renamed "sample" to "demo; some minor bug fixs