added $ for refs and removed == for ref test

== in refs should use the pointer to compare