Fixed minor test bug and added tests for wait execution for correct
states.