File existence was not correctly checked