added stricter file check