minor modification to expand.c