trying to fix a maddening code example