valueToInt() now supports negative numbers