fix space optimization