Further fixes for type safety.