fixed problems with negative numbers