Fix runtime warnings in tests