Fix crashes; start to implement serialization to other formats than QDataStream