Fix/tern v2

Fixed addon error when using Tern.

Supercedes #1777