fixed bugs with negative numbers and 0