Modify downloadPage function.