fixed the hungry method