added chk_row func