Fixed possible bugs
Improved rename method