fixed expand code