handle last row equals to zero