uninitialized bool causing erratic behaviour