optimized clone function

removed expensive deepcopy operation for __class__()