fix referencing bugs
test