SERVER-6018 Use typename and casts