Make sure toInt is defined before calling it -- Related to #1934