Handle unknown lastgroup
Fix find query