Add guard to export function