fixed error checks and other bugs in board logic