Copying contents of file undefined to undefined