check for cd or exit