Fixed some memory problems. Now segments are only created in growing state.