remove mallocs and fix nick tab completion