fix the empty row problem by reducing k until it doesn't throw