What legal problem did Justinian the Great face when he became emperor?