download function fix