Fixed keyerror bug partrefs