several fixes to make upload work