Minor fixes to various state pack/unpack logic