added deep copying for methodobj and variablobj