fixed #24, use pathname for file extensions checks.