fix some issues with negative numbers