fix bug in ~ selector