Fixed bug in fstream copy