Fixed Cross Threading

* Fixed an issue with a cross-threading violation.