Bug fix (#172): Check the variable is nil correctly

PTAL