fixed bug in renaing if old file exists