Fix reference insert NPE and build missing reference citations from pieces
Merge branch 'master' into jetty