Fix path insert bug. Closes #2947.