Use finfo to determine mime type. Fixes #183