thread safety workaround