add debug flag
adjust completion candidate sorting