Better resize behavior

For #387