Fixed compilation errors in sample code