fix a bug in dynasty.py