Bug fix, equiv of 0fa358e985ddf568d60491b0fe62ee37d7360d6a on master