fix loop in getAllData method