Change the type checking of integers a bit to make state monitors work under Python3 as well