correcting error in processing the return of MySQL