fix for thread-safety