Fix bugs introduced by #4754