fix add relationship bug, and reset sql to null after each execution