Add some explicit casts to fix the TESLA build.