Modify the procedure of write info into file