Fixed a bug where keys where serialised twice