fix for patients query