 											versionsCallback err
 											return
 										versionNumber = versionPackageXml.package.packageinformation[0].version[0]
+										# the tar file is incorrectly named -> abort
+										if (versionNumber.replace (new RegExp ' ', 'g'), '_') isnt path.basename versionFile, '.tar'
+											fileCallback "version number does not match file (#{versionNumber.replace new RegExp(' ', 'g'), '_'} != #{path.basename versionFile, '.tar'})"
+											return
+										
 										currentVersion = { }
 										currentVersion.versionnumber = versionNumber
 										currentVersion.license = versionPackageXml.package.packageinformation[0].license?[0]
-										
-										# the tar file is incorrectly named -> abort
-										if (currentVersion.versionnumber.replace new RegExp(' ', 'g'), '_') isnt path.basename versionFile, '.tar'
-											fileCallback "version number does not match file (#{currentVersion.versionnumber.replace ' ', '_'} != #{path.basename versionFile, '.tar'})"
-											return
 										currentVersion.fromversions = (instruction.$.fromversion for instruction in versionPackageXml.package.instructions when instruction.$.fromversion?)
 										currentVersion.requiredpackages = versionPackageXml.package?.requiredpackages?[0]
 										currentVersion.excludedpackages = versionPackageXml.package?.excludedpackages?[0]
 										currentVersion.timestamp = versionFileStat.mtime
 										currentPackage.versions[versionNumber] = currentVersion
 										# TODO: optionals
+										
 										logger.log "debug", "Finished parsing #{versionFile}"
 										versionsCallback null
 							, (err) ->

	if auth.packages?
		for _package, version of auth.packages
			_package = _package.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1").replace(/\\\*/, '.*')
			if RegExp("^#{_package}$", 'i').test testPackage
				return true if version testVersion
	
	# check user
	if auth.users?[username]?.packages?
		for _package, version of auth.users[username].packages
			_package = _package.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1").replace(/\\\*/, '.*')
			if RegExp("^#{_package}$", 'i').test testPackage
				return true if version testVersion
		# check user groups
		for group in auth.users[username].groups
			if auth.groups?[group]?
				for _package, version of auth.groups[group]
					_package = _package.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1").replace(/\\\*/, '.*')
					if RegExp("^#{_package}$", 'i').test testPackage
						return true if version testVersion
	false

# extracts and parses the package.xml of the archive given as `filename`

						auth.users[user].packages[_package] = createComparator versions for _package, versions of auth.users[user].packages
				logger.log "notice", "Updated auth"
			catch err
				logger.log "error", "error parsing auth.json. Denying access to all packages: #{err}"
				auth = {}
	
	fs.readdir config.packageFolder, (err, files) ->
