cast-related warnings fixed