modified to choosen file name and avoid thread lock