fix wrong cast