Added output buffering to the export function to prevent output corrupti...

...on.

Added ob_start/ob_end_clean, which prevent warnings from being part of the data sent to the browser/client.