Fix permalink scheme got replaced, and fix newsitem's destroy hook to check if permalink is not nil before hashing it