Fixed crash in renaming category. Merged Louis's contributions with
Jan's contributions.