fixed a problem with duplicate references