Fixing up a few bug from the refactor