avoid use-after-free in dep resolution

Fixes GHI#82.