Made the getter/setter functions thread-safe