Ended up reading a similar question & found the problem from this question:
cs50 pset2/vigenere - code doesn't work if text and key differ upper/lower case
problem was this case:
"Finally, when a letter is encoded, j is incremented. But consider what happens when the key letter is uppercase and the next key char is lower case. Because j is ...