Set dir variable to correct value.