Fix instance detection for inliner optimization

Caused by #648
Merge pull request #659 from dylex/imminstance

Fix instance detection for inliner optimization