fix issue with proto methods being wiped off objects when cloning