Fix source chaining/unchaining

Contains also some changes from https://github.com/sourcefabric/Superdesk/pull/65 which were required here so first pls merge that one.