Fixed issue where path is sometimes undefined or null.