move fileopen operations to constructors.