Changing static variables to volatile.