fixed build directory checking