made variable volatile that should be volatile