improve funcnality of receive file thread