Fixed incorrect casting method.