added some error protection and all method types for echo
return query as a object literal and not an array