Better file validation