Merge pull request #487 from thotypous/master

Cleanup link_states and fix a rare highlight bug