fix pre-launch bug (fix #1772)
and add tests
Merge pull request #1779 from jlipps/master

fix pre-launch bug (fix #1772)