fixed bug in gameover function and added two tests for it