fixed sql problem