I cannot confirm a bug with wait, but you're calling contractVal with an unitialized struct. You got probably a crash in the R library.