Preventing empty elements when building wrap elements