type stability improvements