fixing wait for statements in the main file body

closes gh-65