Fix serialisation problems