correction to sample code