Auto-completion fixes

Fixes #174 and #202