Reduction of homomorphisms mod p and algebraicity