fixed inversion of flags bug, added destination folder