fixed bug with many references