fixed some misbehavior of the ~ expansion