changed head and tail to automatically collapse the given path