4.0.x: Fix SF 4.1 compatibility

CC @jhoeller