Fix misc. errors identified in tests