Bugfix palette

Fixes #978

Also removes weakrefs, since I don't see their point here.
Although it looks like it is only used in this file and I am hyper-sensative to this sort of thing so you should probably disregard my comment.