Fix bug when tagging problems using tagging menus which can accidentally remove lines from the pg file.