added error checking for poll completion