trying to fix delete older than threshold query