fixed some bugs AJ found