Merge pull request #824 from clebertsuconic/master

optimization on direct-delivery + test fix