fixed issue where SELECT would fetch all rows in first call