fixed ordering bug in compose_expand, some other minor stuff