fixed hardcore serialization to match haskell side, removed some unneeded resizing.