finally got export working correctly