fix for cast and convert generic types