fix wrong cast. thanks to OnlyHuman