fixed issues with negative numbers (clumsily)