rename file and buffer function