Fix bugs introduced with refactors.