Yet another fix to castling logic