rewrite & fix autocomplete for v0.4