[common] fix a couple of issues with perthreadvalue