added missing imports and references to self