use setuptools instead of distutil, fix undeclared vars