Changed lstat back to stat (I misunderstood the difference between the two); test works properly