add error catching and ignore errors while looping on each files