Fix two of the three bugs in #3122