adds new handling of boundary mask in border rag building