Fix the casting glitch

Quick fix for #437