fix RefDec() to clear unit tests.  add casting to atomic operation on void pointer so OSX would compile