improve completer, fix couple of bugs