bug fixes and got serialization working