fixed up the export function