a few bug fixes with the new structure