Fixed autocompleter sometimes removing words

Fixes #149