Fix warnings from casting