fixed self referal detection