fix get neighbors bug by returning neighbors at the end of method