Fix bug where build folder is replaced more than once