fix crashing when chip is placed near the edge of the board