Added volatile modifier to make it with -O3 optimization.