Made flag volatile
Corrected check in runAll()