Fixed bug in chaining