Fix NullPointerException with command execution