added check for validity of course ID