Check for isfile() instead of exists().