fixed bug with 0 results wiping last id