Fixing space issue for ST_REFERENCE