check to be sure phase is valid before checking its id field
Merge pull request #38 from epaulson/phase-npe-fix

check to be sure phase is valid before checking its id field