fixing some errors in the way results are retrieved