fixed some issues with negative numbers