Small speed up in compact()