ljglibs: Fix some reference handling