use delegate correctly in sample app