Fixed a bug where it does not find building ref.