Fix sample code base on feedback.