fix bugs
Merge pull request #3 from pam81/principal

fix bugs