fix comment ending logic