Added rename file and fixed some minor bugs.