Fix bugs
Add check and checkmate