Fixes bug in previous commit
(cherry picked from commit 6917fe388c9724bd82edbc3546258c554b952f3b)