Volatile flag added to some variables