Fixed some issues with the sample code.