Potential fix for categories crash

I'm still not sure how we're getting the "Illegal attempt to establish a relationship 'categories' between objects in different contexts" error, but trying this from something I've read in the dev forums.

Hopefully resolves #15