Fix NPE handling some commands

Signed-off-by: Ross Allan <rallanpcl@gmail.com>