bug fixes and speed up for createPath in views.py