Added fetchAll statements to fix buffer problem