fixed deletion of indexs in commands, but now cannot free commands itself