changes for threadsavety