# api.modifyClass sometimes(!) not working

**URL:** <https://meta.discourse.org/t/api-modifyclass-sometimes-not-working/212413>\
**Category:** Bug\
**Created:** [December 17, 2021, 7:54am UTC](https://meta.discourse.org/t/api-modifyclass-sometimes-not-working/212413 "2021-12-17T07:54:25Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [December 18, 2021, 9:20am UTC](https://meta.discourse.org/t/api-modifyclass-sometimes-not-working/212413/11 "2021-12-18T09:20:01Z")

</div>

Ok, I saw a notification from a helpful post that apparently has been removed in the meanwhile.  
The suggestion did not work but it did contain a clue that helped me resolve this.

Adding the following snippet **below the non-working code** consistently resolved the issues I was having. I have tested this on multiple independent forums, both on stable and on tests-passed. I think this should be reclassified as #Contribute > Bug …

```plaintext
<script type="text/discourse-plugin" version="0.1">
const userModel = api.container.lookup("model:user");
</script>

```

@Johani thank you for your help!

---

_[View the full topic](https://meta.discourse.org/t/api-modifyclass-sometimes-not-working/212413)._
