1. fix a stupid bug in extract_path()