Allow mime-type to be specified in queries
Fix up mime-type handling