Fixed a bug of AddMethods with private members.