improved ob_end_clean for download handler
fix register nonce and register catch errors
Merge pull request #4445 from toddlahman/master

improved ob_end_clean for download handler