the sample code had a bug