Refactor but now get 'ClientError: pixels instance must be managed'