Fix build directory handling