modified file object from pointer to a static normal variable. two mallocs still to remove