added os check before wait