Fixed select/after/before to empty the document if it doesn't exist.