Fix bugs in previous merge.