Fix FTP and API export
* Filter out not exportable variables.
* Correctly generate flagStatus and flagReason.