Added checks for compatibility with Python 3.3