fixed build.dir var handling