changed order of setting BASEDIR variable