fix some cast warnings