support X_FORWARDED_FOR
close temporary files properly
minor fix