allow out-of-tree builds (fixes for config.h)
removed unused i variables