add is_numeric check to substr()

add is_numeric since those can be implicitly converted to strings