check for $CMSSW_BASE before using it

(not really tested)