fixed the intersection problem and the grid drawn in the editor.