fixed routine to parse integers