Fix obscure bug in `moves' function