fixed bug, where it did not check the last object in chain