fixes a bug in simulate
Merge branch 'master' of https://github.com/dschen/429 into carolyn