check err of wait