Fix generic type bugs.