made add_command more robust