move openFlag checks to constructor.