cast correctly