fixed toJSON error