Fix bugs in the magic skill plugin