Fix a cross thread issue