optionally use libmagic for better MIME-type guessing; fixes #4