Fixed bugs in setup script and improved flexibility when moving sources