This will crash, if self.parent.cover does not exist.
I do not yet understand the code good enough, so: Is self.parent.cover always set?