Fixed checking it's a file not directory