Fix for UI thread violation error.