Fixed bug when source or destination is null