works for negative numbers not for positive