handle self-loop @ spark