Added check that file is not dir.