fix kmheapa() and add kmheapf()