fixed the routine for getting elements from given patient list