Fix file required attribute.
Add more error catching.