Avoid illegal moves (still rather unsuccessfully).