fixed file existance check