Change k limiting code, i think the code was buggy.