Fix dialyze warning for cast