account for changing maindir