Adding some null checks for commands.