Fixs for upstream refactoring