Backport Lioncash - Fix some compile warnings realted to casting