added check that folder exists