Fixes to tail handling in reference linker