Fixed a large number of checkmate bugs