Prevent exception when resolving (fixes #411)

I don't like the way this is handled but I don't have any clear test case / way to reproduce it currently. Maybe we should not merge it?