Fix #908
(cherry picked from commit a3a425666db96dd77db7cd128ee0025df81c78cf)