Better error for ambiguous instance name

Fixes #1066