adapted chunked_dot so that it works