Bugfixes to castling logic
More fixes to castling logic