Fixed bug when dealing with 0 values