fixed the horrible memory error