modified the isInteger method