Made mode variable volatile for correctness.
Merge branch 'dev'