If you click a cell and it becomes occupied before you can click the "place cells" button, you can either click the cell again to "unflag" it, or refresh the page. I'm assuming this is the problem you're describing.
I should add some hover-state that shows the cell's owner on the board.