`last` was used but not initialized. Also fixes a segmentation fault if PATH is not in the environment.