fix max_k