How do you know that it's a glitch in the coding? You can't prove that, unless you have the programming source. But look at the circumstance of the appearance of Aeris's ghost in the game and the appearance of Zack's ghost in the photo, both of them match, proving that the Aeris's ghost is not a glitch, despite the effect of her ghost before she died though, unless that was meant to be a prediction for Cloud. You know what's funny? He doesn't seem surprised when she died, but then again, that could be his personality [trauma casued by his mother death] but who knows.