Serializeable casting fix