Fixed the condition to check the current path.