Fixed NPE's on startup and command