fixed sql ouput