fix various issues w.r.t. logging, add SYS_PYTHON_VERSION constant, fix missing imports