Correctly handle "0" thread local keys

a3fd3622 created issue #197, which was fixed as a side effect of
49eb836b because I left out an assert(). Anyway this should fix the
underlying issue in all cases.