added toJSON() override for serialization