cmd_history: make sure the index is clean before running am