use mimetypes in file detection for better predictability
better logging
fix merge