Use NPE safe method to register commands