Fix reference code sample

I believe it is a logic typo in reference.