Added require for pathname, fixed pathname usage