fix crash if no rows when writing kbart