Various fixes, mostly related to intermine/intermine#325