Fixes #20: Add timeout in environment.wait().