Fixing bugs caused by prior refactor