fixed rotateByCopy to avoid any rename()

fixes issue #3989