Download function fix