Add RootContext and fix some build issues