Prevent a cross thread operation exception