fix small data structure bugs