Expand variable correctly