Fix up some bugs in previous commits