bug fixed works with K = 0.