Add more warning detections
Make type casts safer.