Use type cast to fix type warning