Func to check source and target exists