added missing open/close and inject