Fixed little logical error in sample.cpp.