add mask to trails computation