Added fix for cases of sending binary and text files