Fix TypeTest by running optimize after creating new type to make sure it exists