Fixed errors in sample code