Fixed the exception on empty row in the middle