small fix in reference counting
add reference test
test comments