Add tag flag support in reference tree loader.
More tests for the reference tree loader.