Handle wait error properly