Fix bad and stupid handling of ~.