several fixes and optimizations to JSON parsing / serialization and TDocVariant process