I moved the initialization of openFlag to constructor.