Somewhat clumsy way to make file downloads work