Fix build error with generics