Fixed JavaFX thread error