generify the cast