Fix referer saving, close #1738