File validation improved