error checking and long timeout