Fixed JavaFX threading problems.