Minor fixes that were causing tests to fail sometimes.