Fix missing init of self in toJSON()