Collection object transform function is given a collection object as well

Pull request for #1213.