fixing serialisation of objects