improve rectangular fit