Fixed download fucntion