fixed sql export