Added check for file existence in template resolver