Fixed a crash in chain plugin