fixed a bug in board::valid()