using synchronize key word to guarantee mutable variable.