Minor fix on generics type cast