Added some casts to fix fast-and-looseitude with gesture states