Fixed compact issue - compact should always be followed by flip for memory reduction.