Fixed a NullPointerException in the StageListener