optimize some sep|path problem