Fixed patient id query dies on >1000