handle received file correctly