Fix cast warnings