fixed bugs in tab completion