BUG: fix scoping of betterlink var