bugfix in parse_apfile
restructuring for fewer try/except obfuscations