fixed bug in expand commands