changes for thread savety