fixing empty row bug