fix flaky tests and possible NPE in blob container

you could do this in one if-statement, but that's personal preference