Bug fixes around spanning refs