fixed reference comparison bug and editor bug

...it is possible that comparison fix may have caused some other
trouble, i will check it later