Fixed bugs in rename().