fixed email problem with file path and enhanced detection of older files