Fix cast warnings (wip)