Fix a bug in commit 59642c758c68d448a7f905a01e95cfcbce85d2c9.

I messed this up while revising Rushabh's patch.

Analysis and fix by Rushabh Lathia.