Improved performance of getInteger helper function.