improved checkPy script