corrects file extension code to use pathinfo. fixes #2