making build script more robust