Fixes #5090

(cherry picked from commit bd5bc07064bd4a7bdb2d1a0f487c25ab6f8302e3)