Fix NullPointerException on autostart