We propose a method called the residual edge-betweenness gradient (REBG) to enhance the synchronizability of networks by assigning the link direction while keeping the topology and link weights unchanged. Direction assignment has been shown to improve the synchronizability of undirected networks in general, but we find that in some cases incommunicable components emerge and networks fail to synchronize. We show that the REBG method improves the residual degree gradient (RDG) method by effectively avoiding the synchronization failure. Further experiments show that the REBG method enhances the synchronizability in networks with a community structure compared with the RDG method. Copyright © 2011 American Physical Society.