added better handling of csv responses in readByQuery